package o;

import android.content.Intent;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.packagemanager.api.bean.ManagerTask;
import com.huawei.appmarket.service.deamon.download.remote.DownloadAgentService;
import com.huawei.appmarket.service.webview.base.jssdk.control.FullAppStatus;
import com.huawei.updatesdk.service.otaupdate.UpdateKey;

public abstract class dwp {
    public static void ॱ(ManagerTask managerTask, int i, int i2) {
        if (managerTask.ॱॱ instanceof SessionDownloadTask) {
            SessionDownloadTask sessionDownloadTask = (SessionDownloadTask) managerTask.ॱॱ;
            String ॱˎ = sessionDownloadTask.ॱˎ("mediaPkg");
            ॱ(sessionDownloadTask.ॱˎ("callerPkg"), ॱˎ, managerTask.packageName, i, i2, sessionDownloadTask.ॱˎ("contentId"), sessionDownloadTask.ॱˎ("downloadFlags"));
            ˏ(managerTask.packageName, i, i2);
            return;
        }
        ॱ("", "", managerTask.packageName, i, i2, "", "");
        ˏ(managerTask.packageName, i, i2);
    }

    private static void ॱ(String str, String str2, String str3, int i, int i2, String str4, String str5) {
        int i3 = 0;
        Intent intent = new Intent("com.huawei.appmarket.service.installerservice.Receiver");
        switch (i) {
            case 1:
                intent.putExtra(UpdateKey.STATUS, -2);
                i3 = -2;
                break;
            case 2:
                intent.putExtra(UpdateKey.STATUS, 0);
                break;
            case 3:
                intent.putExtra(UpdateKey.STATUS, 1);
                i3 = 1;
                break;
            case 4:
            case 12:
                intent.putExtra(UpdateKey.STATUS, -1);
                intent.putExtra("resultcode", i2);
                i3 = -1;
                break;
            case 5:
            case 11:
                intent.putExtra(UpdateKey.STATUS, 2);
                i3 = 2;
                break;
            default:
                return;
        }
        intent.putExtra(DownloadAgentService.PACKAGE_NMAE_ARG, str3);
        FullAppStatus fullAppStatus = new FullAppStatus();
        fullAppStatus.ˊ(str3);
        fullAppStatus.ˏ(i3);
        fullAppStatus.callerPkg_ = str;
        fullAppStatus.mediaPkg_ = str2;
        fullAppStatus.appType_ = 1;
        fullAppStatus.contentId_ = str4;
        fullAppStatus.extendDownloadFlags_ = str5;
        enf.ˋ().ˊ(fullAppStatus);
        ContentManager.getInstant().getContext().sendBroadcast(intent);
    }

    private static void ˏ(String str, int i, int i2) {
        Intent intent = new Intent("com.huawei.gamebox.service.installerservice.Receiver");
        switch (i) {
            case 1:
                intent.putExtra(UpdateKey.STATUS, -2);
                break;
            case 2:
                intent.putExtra(UpdateKey.STATUS, 0);
                break;
            case 3:
                intent.putExtra(UpdateKey.STATUS, 1);
                break;
            case 4:
            case 12:
                intent.putExtra(UpdateKey.STATUS, -1);
                intent.putExtra("resultcode", i2);
                break;
            case 5:
            case 11:
                intent.putExtra(UpdateKey.STATUS, 2);
                break;
            default:
                return;
        }
        intent.putExtra(DownloadAgentService.PACKAGE_NMAE_ARG, str);
        ContentManager.getInstant().getContext().sendBroadcast(intent);
    }
}
